const rich = {
  percentStyle: {
    color: "#468EFD",
    fontSize: 14,
    padding: [5, 4],
    align: "center",
  },
  hr: {
    borderColor: "#5470C6",
    width: "100%",
    borderWidth: 0.5,
    height: 0,
  },
};
const echartData = [
  {
    value: 487,
    name: "文化活动",
  },
  {
    value: 200,
    name: "竞技活动",
  },
  {
    value: 675,
    name: "系列活动",
  },
] as any[];
const color = ["#fbdd66", "#00bcff", "#f2637b", "#a586fd", "#1ed0bc"];
export const getActivitiesNumberOption = () => {
  return {
    title: {
      top: 15,
      left: 15,
      textStyle: {
        fontSize: 16,
        color: "#fff",
      },
      text: "年度不同类型活动数量信息",
    },
    tooltip: {
      trigger: "item",
      formatter: "{a} <br/>{b}: {c} ({d}%)",
    },
    legend: {
      show: true,
      orient: "horizontal",
      x: "center",
      y: "bottom",
      data: ["文化活动", "竞技活动", "系列活动"],
      padding: [0, 0, 15, 0],
      textStyle: {
        color: "#468EFD",
      },
    },
    series: [
      {
        name: "总考生数量",
        type: "pie",
        radius: ["30%", "50%"],
        hoverAnimation: false,
        color: color,
        label: {
          formatter: function (params: any) {
            var total = 0;
            var percent = 0;
            echartData.forEach(function (value) {
              total += value.value;
            });
            percent = ((params.value / total) * 100).toFixed(1) as any;
            return (
              "{percentStyle|" +
              percent +
              "}%\n{hr|}\n{percentStyle|" +
              params.name +
              "}"
            );
          },
          rich: rich,
          color: "#468EFD",
        },
        labelLine: {
          length: 25,
          length2: 0,
          lineStyle: {
            color: "#468EFD",
          },
        },
        data: echartData,
      },
    ],
  };
};

for (var i = 0; i < echartData.length; i++) {
  echartData[i].itemStyle = {
    borderWidth: 5,
    shadowBlur: 20,
    borderColor: color[i],
    shadowColor: color[i],
  };
}
